﻿using System.Windows;
using System.Windows.Controls;
namespace IdResourceModule.Views
{
    /// <summary>
    /// Interaction logic for MeasurementResultList
    /// </summary>
    public partial class MeasurementList : UserControl
    {
        /// <summary>
        /// 
        /// </summary>
        public MeasurementList()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = e.Row.GetIndex() + 1;
        }
 
        private void BtnSearch_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            pgtList.PageIndex = 1;
        }
       
        private void menuCopyName_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var info = ListViewBloodPressure.SelectedItem as CoreModule.MeasurementResultInfo;
            if (info == null)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(info.PatientInfo.PatientName))
            {
                return;
            }
            Clipboard.SetText(info.PatientInfo.PatientName);
        }
        private void menuCopyWdCode_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var info = ListViewBloodPressure.SelectedItem as CoreModule.MeasurementResultInfo;
            if (info == null)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(info.PatientInfo.WdCode))
            {
                return;
            }
            Clipboard.SetText(info.PatientInfo.WdCode+"");
        }
        private void menuCopySocialCard_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var info = ListViewBloodPressure.SelectedItem as CoreModule.MeasurementResultInfo;
            if (info == null)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(info.PatientInfo.SocialCard))
            {
                return;
            }
            Clipboard.SetText(info.PatientInfo.SocialCard);
        }
        private void menuCopyIdCard_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var info = ListViewBloodPressure.SelectedItem as CoreModule.MeasurementResultInfo;
            if (info == null)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(info.PatientInfo.IdCard))
            {
                return;
            }
            Clipboard.SetText(info.PatientInfo.IdCard);
        }
    }
}
